﻿using System.Drawing;
using System.Windows.Forms;

namespace Ensemble_Windows.UI.Panel
{
    /// <summary>
    ///     Panel帮助类
    /// </summary>
    public class PanelHelper
    {
        /// <summary>
        ///     创建Panel
        /// </summary>
        /// <returns>Panel</returns>
        public static Panel Create()
        {
            return new Panel();
        }

        /// <summary>
        ///     创建Panel
        /// </summary>
        /// <param name="width">宽度</param>
        /// <param name="height">高度</param>
        /// <param name="location">位置</param>
        /// <param name="form">Form窗体</param>
        /// <returns>Panel</returns>
        public static Panel Create(int width, int height, Point location, Form form)
        {
            var panel = new Panel
            {
                Width = width,
                Height = height,
                Location = location
            };
            form.Controls.Add(panel);
            return panel;
        }

        /// <summary>
        ///     创建Panel
        /// </summary>
        /// <param name="width">宽度</param>
        /// <param name="height">高度</param>
        /// <param name="location">位置</param>
        /// <param name="control">Control</param>
        /// <returns>Panel</returns>
        public static Panel Create(int width, int height, Point location, Control control)
        {
            var panel = new Panel
            {
                Width = width,
                Height = height,
                Location = location
            };
            control.Controls.Add(panel);
            return panel;
        }
    }
}